package Test.xinri;

import cn.hutool.crypto.digest.DigestUtil;
import weaver.common.DateUtil;

/**
 * @author dusongsong
 * @date 2023年06月01日 16:49
 */
public class testAPI {

    public static void main(String[] args) {
        String str = "2023-07-03";
        System.out.println(DateUtil.getWeek(str));
    }


    public static void test(){
        //该秘钥获取路径“设置-安全设置-系统安全策略-SSO”（若无此入口，需项目经理在boss系统开通相关许可）
        String entCode = "EC3RDMXYW96AMD";
        String ssoSecret = "EC3RDMXYW96AMD:YZFhXH0yyj8xPI1W34OJeUdxaczsPpkB";
        long timestamp = System.currentTimeMillis();
        String userId = "10211";
        String ssoToken = getToken(ssoSecret, userId, timestamp);
        System.out.println("https://uat.maycur.com/sso?entCode=" + entCode + "&userId=" + userId + "&timestamp=" + timestamp + "&token=" + ssoToken +
                "&ssoMode=sso&language=zh&url=");
    }

    public static String getToken(String ssoSecret, String userId, long timestamp) {
        return DigestUtil.sha256Hex((ssoSecret + ":" + userId + ":" + timestamp).getBytes());
    }
}
